package org.misty.groovy.first

import groovy.transform.CompileStatic
import javafx.application.Application
import javafx.scene.Scene
import javafx.scene.control.Label
import javafx.scene.layout.StackPane
import javafx.stage.Stage

/**
 * Created by Misty on 2015/6/9.
 */
@CompileStatic
class GroovyApp extends Application {
    static long start
    static long end

    @Override
    void start(Stage primaryStage) throws Exception {
        def scene = new Scene(new StackPane(new Label("Loading")), 400, 300)
        primaryStage.title = "Groovy JavaFX Application"
        primaryStage.scene = scene
        primaryStage.show()

        end = System.currentTimeMillis()

        def total = end - start
        println(total)

        def file = new File("groovy-static.txt")
        file.withWriterAppend {
            it.append("$total\n")
        }
    }

    public static void main(String[] args) {
        start = System.currentTimeMillis()
        launch(GroovyApp, args)
    }
}
